package org.spolo.android.support.nodetree;

import org.spolo.android.support.tween.InterpolateManager;

import android.content.Context;
import android.graphics.Canvas;
import android.view.View;

public class StageView extends View {
	private long startTime;

	public StageView(Context context) {
		super(context);
	}

	@Override
	protected void onDraw(Canvas canvas) {
		InterpolateManager interpolate = InterpolateManager.getInstance();
		this.startTime = System.currentTimeMillis();
		interpolate.OnTick((this.startTime));
		interpolate.setView(this);
		Stage stage = Stage.getInstance();
		stage.setView(this);
		stage.drawSceneTree(canvas);
		super.onDraw(canvas);
		if (!InterpolateManager.getInstance().isEmpty())
			this.postInvalidate();
	}

	/**
	 * 获取绘制场景树的开始时间
	 * 
	 * @return
	 */
	public long getStartTime() {
		return this.startTime;
	}
}
